<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script> -->
  </head>
  <body>
    <h1>这个html会在 3000端口下运行</h1>
    <!-- <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg2.niutuku.com%2Fdesk%2F1208%2F0759%2Fbizhi-0759-8796.jpg&refer=http%3A%2F%2Fimg2.niutuku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1667026052&t=5890660b0b55f0f5e264172fe8838192" /> -->
    <button>发送ajax请求4000端口的路由</button>
    <!-- <script src="http://localhost:4000/getdata"></script> -->

    <script>
      // 定义一个函数 myfn
      function mytest(arg) {
        let obj = JSON.parse(arg);
        console.log(obj);
      }
      let btn = document.querySelector("button");
      btn.onclick = function () {
        let s = document.createElement("script");

        s.src = "http://localhost:4000/getdata?cb=mytest";

        document.body.appendChild(s);
      };
    </script>
  </body>
</html>
